import request from '@/utils/request'


export function list(params) {
  let createTime = params.createTime
  let current = params.current
  let size = params.size
  if (!Array.isArray(params.createTime)) {
    const date = new Date().strftime()
    createTime = [date, date];
  }
    
  return request({
    url: `api/trainStatistic?createTime=${createTime[0]}&createTime=${createTime[1]}`,
    method: 'get',
    params: {
      current,
      size
    },
  })
}

export function add(data) {
  return request({
    url: 'api/trainStatistic',
    method: 'post',
    data
  })
}

export function del(ids) {
  return request({
    url: 'api/trainStatistic/',
    method: 'delete',
    data: ids
  })
}

export function edit(data) {
  return request({
    url: 'api/trainStatistic',
    method: 'put',
    data
  })
}

export default { list, add, edit, del }
